<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Keu_verifikasi extends MY_Controller {
	
	function __construct()
	{
		parent::__construct(); 
		
		$this->load->model('keu_verifikasi_model', 'GLTrans');
		$this->load->model('keu_transaksi_detail_model', 'GLTransDetail');		
		$this->secure_session();
	}
	
	function index(){
		$data['title'] = "GL Verifikasi";
		$data['data'] = null;
		$data['data']['date_from'] = date('01/m/Y');
		$data['data']['date_to'] = date('t/m/Y');
		
		
		viewByTemplate('keu_verifikasi/index', $data, 'grid');
	}
	
	function getdata()
	{
		$this->secure_session();
		echo $this->GLTrans->GetJSON();
	}
	
	function dtl_account_data()
	{
		echo $this->GLTransDetail->GetJSON();
	}
	
	function verifikasi()
	{	try
		{
			$li_num_row =intval($this->data['num_row']);
			if ($li_num_row>0){
				for ($i = 0; $i < $li_num_row; $i++)
				{
					$data['STATUS_VERIFIKASI']	= 'Y';
					$data['TGL_VERIFIKASI']	= NOW;
					$data['USER_VERIFIKASI']	= USERID;
					$this->GLTrans->Update($data, array('id_dok'=>$this->data[$i]['id_dok']));	
				}
				$is_error = 0; $ls_response = 'Proses Verifikasi berhasil';
			}else{
				$is_error = 1; $ls_response = 'Silahkan pilih data transaksi';
			}
		} catch(Exception $e) {
			$is_error = 1; $ls_response = $e->getMessage();
		}
		
		$arr_response = array("is_error"=> $is_error, "msg"=>$ls_response);
		echo json_encode($arr_response);
	}
	
	
	
}
?>